
package frontera;


import java.awt.Color;
import java.awt.Component;
import javax.swing.JLabel;
import javax.swing.JTable;
import javax.swing.table.DefaultTableCellRenderer;
import javax.swing.table.JTableHeader;
import javax.swing.table.TableColumn;
import javax.swing.table.TableColumnModel;

public class FormatoTabla extends DefaultTableCellRenderer
{
 public Component getTableCellRendererComponent
 (JTable table, Object value, boolean selected, boolean focused, int row, int column)
 {
     
     if(column == 0) {
          JTableHeader th = table.getTableHeader();
  
  TableColumnModel tcm = th.getColumnModel();
  
  TableColumn tc = tcm.getColumn(0);
  
  tc.setPreferredWidth(10);
         
     }
     
     

         
  if(String.valueOf(table.getValueAt(row,column)).equals("Creada"))  this.setForeground(Color.blue);
                  
  else if(String.valueOf(table.getValueAt(row,column)).equals("Revisada")) this.setForeground(Color.green);
  
  else if(String.valueOf(table.getValueAt(row,column)).equals("Ejecutada")) this.setForeground(Color.magenta);
  
  else if(String.valueOf(table.getValueAt(row,column)).equals("Bloqueada"))   this.setForeground(Color.red);
  
  else if(String.valueOf(table.getValueAt(row,column)).equals("Terminada"))   this.setForeground(Color.orange);
  
  
 
  
  else this.setForeground(Color.black);
  
 
  
  
  

  
  
  
  
      
 

    
 super.getTableCellRendererComponent(table, value, selected, focused, row, column);
 return this;
 //return P; 
 }
 }